package com.atguigu.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/s1")
public class Servlet1 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("Servlet1");
        PrintWriter writer = resp.getWriter();
        writer.write("servlet1运行了");
        //1.获取请求的参数
//        String name = req.getParameter("name");
//        String age = req.getParameter("age");
//        String address = req.getParameter("address");
        //2.把请求的参数封装到pojo中
//        User user = new User();
//        user.setName(name);
//        user.setAge(age);
//        user.setAddress(address);
        //3.把pojo封装到request中
    }
}
